﻿namespace Common.Orm
{
    public class JoinTable
    {
        /// <summary>
        /// 表名称
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        /// 主表关联字段
        /// </summary>
        public string ColumnName { get; set; }

        public string[] ShowFields { get; set; }

        private string _joinType;

        public string JoinType
        {
            get { return _joinType; }
            set
            {
                switch (value)
                {
                    case "InnerJoin":
                        _joinType = "inner join";
                        break;
                    case "LeftJoin":
                        _joinType = "left join";
                        break;
                    case "RightJion":
                        _joinType = "right jion";
                        break;
                    default:
                        _joinType = "inner join";
                        break;
                }
            }
        }

        public JoinTable(string tableName, string columnName, string[] showFields)
        {
            TableName = tableName;
            ColumnName = columnName;
            ShowFields = showFields;
        }
    }
}